﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ExcelOperateForNPOI;
using Time;

namespace ExpTest
{
    public partial class frm_OpenExcelFileForNpoi : Form
    {
        public frm_OpenExcelFileForNpoi()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Timeing.LongFrequency();
            Timeing.Timeing_Begin();

            if (openFileDialog1.ShowDialog() != DialogResult.OK) return;
            string ifilepath = openFileDialog1.FileName;

            List<string> isheetnames = new List<string>();
            if (C_ExcelForNPOI.SheetNames(ifilepath,ref isheetnames) == false) return;
            List<string> iselectsheetnames = new List<string>();
            if (C_ExcelForNPOI.ShowSeleSheets(isheetnames, ref iselectsheetnames) == false) return;
            bool iRet = C_ExcelForNPOI.OpenExcelFile(ifilepath, iselectsheetnames[0], 1, 0, ref dTable_cl);
            if (!iRet)
            {
                MessageBox.Show("打开Excel文件出错！\n" + C_ExcelForNPOI.ErrMeg);
            }

            Timeing.Timeing_End();
            Timeing.Time_Count();
            label1.Text = Timeing.TimeCount.ToString();
        }
    }
}
